import requests
from lxml import etree
from config import Config
from DrissionPage import WebPage
import time
from 贴吧图片 import OnePiece
from bs4 import BeautifulSoup

op = OnePiece()
conf = Config()
headers = conf.headers
session = requests.Session()
url='https://tieba.baidu.com/photo/p?kw=%E6%B5%B7%E8%B4%BC%E7%8E%8B&flux=1&tid=7295477883&pic_id=7a35367adab44aed82cfdaaaa41c8701a08bfbad&pn=1&fp=2&see_lz=1&post_id=138717529061'
response = op.get_response(url)
selector = etree.HTML(response)
thumbnail = selector.xpath("//script[contains(text(), 'viewfloatPageData')]/text()")
print(thumbnail)
# soup = BeautifulSoup(response)
# links = soup.find_all('img',attrs={'class':'BDE_Image'})
# for link in links:
#     print(link.get('src'))
# response = session.get(url=url, headers=headers)
# with open('ceshi.jpg','wb') as file:
#     file.write(response)



